while True:  # 不停循环
    try:
        op = input("请输入一个四则运算（例如1+2）：")
        if '+' in op:
            a = op.split("+")
            r = int(a[0]) + int(a[1])
            print(r)
        elif '-' in op:
            a = op.split("-")
            r = int(a[0]) - int(a[1])
            print(r)
        elif '/' in op:
            a = op.split("/")
            r = int(a[0]) / int(a[1])
            print(r)
        elif '*' in op:
            a = op.split("*")
            r = int(a[0]) * int(a[1])
            print(r)
        elif 'C' == op:
            break
        else:
            raise Exception("请按1+2这个格式输入算式")
    except ZeroDivisionError:
        print("除数不能为0")
    except Exception as e:
        print(e)
